#pragma once

#include <condition_variable>
#include <mutex>

namespace AsyncLogger {

	/// <summary>
	/// 倒数类，所有wait的线程在count_==0后才会继续执行
	/// </summary>
	class CountDownLatch {
	public:
		explicit CountDownLatch(int count) :count_(count) {}

		void wait();

		void countDown();

	private:
		std::mutex mutex_;
		std::condition_variable condition_;
		int count_;
	};
}